﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BulletData
{
    /// <summary>
    /// 攻击力
    /// </summary>
    public BaseData Atk { get; set; } = new BaseData();

    /// <summary>
    /// 子弹大小
    /// </summary>
    public BaseData BulletScale { get; set; } = new BaseData(1f);

    /// <summary>
    /// 子弹存活时间
    /// </summary>
    public BaseData BulletLifeTime { get; set; } = new BaseData(1f);

    /// <summary>
    /// 射速
    /// </summary>
    public BaseData BulletSpeed { get; set; } = new BaseData(50f);

    /// <summary>
    /// 子弹击退
    /// </summary>
    public BaseData BulletForce { get; set; } = new BaseData(1f);


    public BulletData()
    {
    }

    public BulletData(BulletData bulletData)
    {
        Atk = bulletData.Atk;
        BulletScale = bulletData.BulletScale;
        BulletLifeTime = bulletData.BulletLifeTime;
        BulletSpeed = bulletData.BulletSpeed;
        BulletForce = bulletData.BulletForce;
    }

    public static BulletData operator +(BulletData data1, BulletData data2)
    {
        BulletData data = new BulletData();

        data.BulletLifeTime = data1.BulletLifeTime + data2.BulletLifeTime;
        data.BulletScale = data1.BulletScale + data2.BulletScale;
        data.BulletSpeed = data1.BulletSpeed + data2.BulletSpeed;
        data.BulletForce = data1.BulletForce + data2.BulletForce;
        data.Atk = data1.Atk + data2.Atk;
        return data;
    }

    public static BulletData operator -(BulletData data1, BulletData data2)
    {
        BulletData data = new BulletData();
        data.BulletLifeTime = data1.BulletLifeTime - data2.BulletLifeTime;
        data.BulletScale = data1.BulletScale - data2.BulletScale;
        data.BulletSpeed = data1.BulletSpeed - data2.BulletSpeed;
        data.BulletForce = data1.BulletForce - data2.BulletForce;
        data.Atk = data1.Atk - data2.Atk;
        return data;
    }
}
